package com.xuebusi.consumer.controller;

import com.xuebusi.consumer.entity.Product;
import com.xuebusi.consumer.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 订单服务Controller
 */
@RestController
@RequestMapping("/order")
public class OderController {
    @Resource
    private OrderService orderService;

    /**
     * 查询商品信息
     *
     * @param productId 商品id
     * @return
     */
    @GetMapping("/buy/{productId}")
    public Product findProductById(@PathVariable("productId") Long productId) {
//        return orderService.findProductById1(productId);
        return orderService.findProductById2(productId);
    }
}
